/**
 * 信任登录相关API
 */

import {
	http,
	Method
} from '@/utils/request.js';
const request = http.request;

/**
 * 小程序自动登录
 * @param params
 */
export function mpAutoLogin(params) {
	return http.request({
		url: '/users/wx-phone-login',
		method: Method.POST,
		data: params
	});
}

/**
 * 获取全部小区
 * @returns {AxiosPromise}
 */
export function getAreaList() {
	return http.request({
		url: "/communities/communities",
		method: 'GET',
	});
}

/**
 * 更换绑定小区
 * @returns {AxiosPromise}
 */
export function updateUserArea(id) {
	return http.request({
		url: `/communities/community/bind`,
		method: 'POST',
		data: {
			communityId: id
		}
	});
}